package com.owg.jigsaw.blocktypes;

import java.awt.Component;
import java.awt.Panel;

import javax.swing.BoxLayout;

import com.owg.jigsaw.WBlock;
import com.owg.jigsaw.WRoot;
import com.owg.jigsaw.slots.MultiSlot;

import javafx.scene.Group;
import javafx.scene.text.Text;

/**
 * A horizontal panel block. A horizontal panel block has a horizontal slot list.
 */
public class WVPanelBlock extends WPanelBlockBase
{
	
	public WVPanelBlock(WRoot root, boolean isPaletteBlock)
	{
		super(root, isPaletteBlock, false);
		getCell(0,0).installContentPane(new Group(new Text("Vertical Panel")));
		getCell(0,0).southSlots.add(children = new MultiSlot(root.getTypeHierarchy().getTypeNode(Component.class), -1));
	}
	
	@Override
	public WBlock copy(boolean withChildren)
	{
		WVPanelBlock b = new WVPanelBlock(root, false);
		/* TODO if(withChildren)
		{
			for(WBlock c : children)
				b.children.add((WLabelBlock) c.copy(true));
		}*/
		return b;
	}

	
	@Override
	protected void installLayout(Panel p)
	{
		p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
	}
}
